package com.Tjise.reflectiondemo;

public class Student implements Comparable<Student> {
    // 属性
    private String stuName;
    private String stuNum;
    private double stuSore;

    // 行为

    public Student() {
    }

    public Student(String stuName, String stuNum, double stuSore) {
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuSore = stuSore;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public double getStuSore() {
        return stuSore;
    }

    public void setStuSore(double stuSore) {
        this.stuSore = stuSore;
    }

    /**
     * 学习的行为
     */
    public void doStuding() {
        System.out.println("I am studing...");
    }

    /**
     * 学习的行为
     *
     * @param strAddress 学习的地址
     */
    public void doStuding(String strAddress) {
        System.out.println("I am studing at " + strAddress);
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", stuNum='" + stuNum + '\'' +
                ", stuSore=" + stuSore +
                '}';
    }

    @Override
    public int compareTo(Student stu) {
        // 比较业务逻辑i的实现
        // 默认值  默认是等于
        int i = 0;
        if (stu != null) {
            if (this.getStuSore() > stu.getStuSore()) {
                // 大于
                i = 1;
            }

            if (this.getStuSore() < stu.getStuSore()) {
                // 小于
                i = -1;
            }
        }
        return i * -1;
    }
}
